home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / More Source / C⁄C++ / Finder ProgressBar 1.1 / FinderProgressBar.doc < prev   
Text File  |  1994-04-29  |  5KB  |  86 lines

  1. /*****************************************************************************************************
  2. *                                                                                                    *
  3. * FinderProgressBar.doc - Copyright 1993 - 1994 Chris Larson, All rights reserved                    *
  4. *                                                                                                    *
  5. * Documentation file of a CDEF which mimics the progress bar used in the Finder. This source file    *
  6. * and its compiled derivatives may be freely used within any freeware/shareware/postcardware/… as    *
  7. * long as you mention my name in your credits. Neither this source nor its compiled derivatives are  *
  8. * in the public domain and may not be use in any form in public domain software. Neither this source *
  9. * nor its compiled derivatives may be used in any form in a commercial product without the expressed,*
  10. * written consent of the author (me).                                                                *
  11. *                                                                                                    *
  12. * Version 1.1 -- April 28, 1994.                                                                     *
  13. *                                                                                                    *
  14. *****************************************************************************************************/
  15.  
  16. This CDEF implements a progress bar that mimics the one used by Finder. It should be extremely
  17. easy to use: simply set the control’s minimum and maximum to whatever values you wish, set the
  18. control value somewhere in-between (endpoints inclusive) and the CDEF will draw appropriately.
  19.  
  20. A couple of things to note:
  21.  
  22. 1)    This CDEF is currently limited in its function -- I wrote it for an application I’m
  23.     working on and didn’t worry about features I wouldn’t need (for example if you hilite it
  24.     with value 255 (supposed to dim a control) it looks the same: my app doeesn’t need to
  25.     dim any progress bars). If you find that extra functionality is a need, drop me a line
  26.     via e-mail and I’ll see what I can do.
  27.  
  28. 2)  This was intended as an EXACT copy (visually at least) of the progress bars used in the
  29.     Finder. As a result, the colors are hard-coded and no AuxCtlRec is ever examined. (This
  30.     really falls under (1) above but I thought it worth mentioning seperately.)
  31.  
  32. 3)    I haven’t had time to test this as extensively as I would have liked, (notably I haven’t
  33.     run it on a Mac without color quickdraw -- I believe the code to be correct but it remains
  34.     untested). As with added features, please send bug reports via e-mail.
  35.  
  36. 4)    If memory serves, the progress bars used by Finder are 11 pixels tall.
  37.  
  38. Porting Notes:
  39. --------------
  40.  
  41. Only a couple things are worth mentioning here, as I have endevoured to make the C portion of
  42. this code as portable as possible. (My apologies if this is not the case -- I don’t have any
  43. other C compilers to test this hypothesis.)
  44.  
  45. 1)    THINK C stores global variables (and static local variables) as offsets from the A4 register,
  46.     which is supposed to point to the top of the code resource. This necessitates the use of
  47.     MySetUpA4(), which stores the old value of A4 and points it to the top of the code resource, and
  48.     MyRestoreA4(), which restores the old value of A4. If porting to another compiler, these calls
  49.     may not be necessary depending on how static local variables are accessed -- consult your
  50.     documentation.
  51.  
  52. 2)    The CalculateBarBoundry function is implemented as inline assembly with register based
  53.     parameter passing. It follows the style of similar functions in the header files, so should
  54.     be portable to other compilers generating 68000 code. For porting to the PowerPC, this function
  55.     will likely need to be rewritten in C. I have provided ample documentation about exactly what
  56.     each instruction does and why I coded it the way I did. There shouldn’t be much difficulty in
  57.     constructing a C version. (I only wrote it in assembly so I could use the mulu.w and divu.w
  58.     instructions instead of a 32 bit multiplication and division library on the 68000 -- see the
  59.     header file.)
  60.  
  61. Legal Stuff:
  62. ------------
  63.  
  64. You know the rules: I have tried to make this as error free as possible but by using it, you take
  65. full responsibility for anything that goes wrong.
  66.  
  67. Author:
  68. -------
  69.  
  70. Chris Larson
  71. 7009 Morton Court
  72. Stockton, CA  95219
  73.  
  74. Internet E-Mail (Preferred) : cklarson@engr.ucdavis.edu
  75.  
  76. Version History:
  77. ----------------
  78.  
  79. Version 1.1 -- April 28, 1994
  80.     • Fixed a nasty bug which could cause the control to draw improperly if given a nonzero
  81.       contrlMin.
  82.     
  83.     • Updated documentation of the inline assembly functions.
  84.  
  85. Version 1.0 -- August 27, 1993
  86.     • Initial Release